<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emp-toolkit: /Users/wangxiao/git/emp-toolkit/emp-input-validity/input-validity/hcot.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo-full-doxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emp-toolkit
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('hcot_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">hcot.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="hcot_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef HCOT_H__</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define HCOT_H__</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &lt;2pctool/2pctool.h&gt;</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno"><a class="line" href="class_hc_o_t.html">    5</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_hc_o_t.html">HcOT</a> {<span class="keyword">public</span>:</div><div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#adac7263c903c7a8449ad7f46f496b56b">    6</a></span>&#160;    bn_t <a class="code" href="class_hc_o_t.html#adac7263c903c7a8449ad7f46f496b56b">y</a>, <a class="code" href="class_hc_o_t.html#a7a36395c32e14e20cf400fdbe9c7ba1e">alpha0</a>, <a class="code" href="class_hc_o_t.html#aa462e01ea0fe150c59534fabae45e693">alpha1</a>;</div><div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a118fd98fa5e2adedf184b452be80ad7e">    7</a></span>&#160;    eb_t <a class="code" href="class_hc_o_t.html#a118fd98fa5e2adedf184b452be80ad7e">g</a>[2][EB_TABLE_MAX];</div><div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a70e477bac83ec6896655403775e12cf0">    8</a></span>&#160;    eb_t <a class="code" href="class_hc_o_t.html#a70e477bac83ec6896655403775e12cf0">h</a>[2][EB_TABLE_MAX];</div><div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a4505d955cd652294a12f69ebac2ea517">    9</a></span>&#160;    bn_t * <a class="code" href="class_hc_o_t.html#a4505d955cd652294a12f69ebac2ea517">r</a> = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#ae252ee4c1b755a0026a427722ad2d64a">   10</a></span>&#160;    <a class="code" href="class_net_i_o.html">NetIO</a> *<a class="code" href="class_hc_o_t.html#ae252ee4c1b755a0026a427722ad2d64a">io</a>;</div><div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#ab4886a4c3628dd0e53bae56cfab49c66">   11</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_hc_o_t.html#ab4886a4c3628dd0e53bae56cfab49c66">sender</a>;</div><div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a13183fe53e5debba15458246c652acf9">   12</a></span>&#160;    <a class="code" href="class_p_r_g.html">PRG</a> <a class="code" href="class_hc_o_t.html#a13183fe53e5debba15458246c652acf9">prg</a>;</div><div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a485f9f51f0cacdd55027024268516829">   13</a></span>&#160;    bn_t <a class="code" href="class_hc_o_t.html#a485f9f51f0cacdd55027024268516829">q</a>;</div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">   14</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>;</div><div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#aa102417d8e202cfaaba27b0171f3ae45">   15</a></span>&#160;    <a class="code" href="class_p_r_g.html">PRG</a> ** <a class="code" href="class_hc_o_t.html#aa102417d8e202cfaaba27b0171f3ae45">prgs</a> = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">   16</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>;</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#acb6acd06a2c710dc7dbd74d2a14aa100">   17</a></span>&#160;    <a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a> *<a class="code" href="class_hc_o_t.html#acb6acd06a2c710dc7dbd74d2a14aa100">Y</a> = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#ab7937e38f9710074431105c401c19228">   18</a></span>&#160;    <a class="code" href="class_hc_o_t.html#ab7937e38f9710074431105c401c19228">HcOT</a>(<span class="keywordtype">bool</span> is_sender, <a class="code" href="class_net_i_o.html">NetIO</a> * _io, <span class="keywordtype">int</span> _k, <span class="keywordtype">int</span> l, <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> * seed=<span class="keyword">nullptr</span>) </div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;        : io(_io), sender(is_sender), K(_k), length(l) {</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;            <a class="code" href="utils__ec_8h.html#a782fdb3f06e7f49116d014d4a583b19f">initialize_relic</a>();</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;            eb_curve_get_ord(q);</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;            <span class="keywordflow">if</span> (is_sender) {</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;                prgs = <span class="keyword">new</span> <a class="code" href="class_p_r_g.html">PRG</a>*[<a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>];</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>; ++i) {</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;                    prgs[i] = <span class="keyword">new</span> <a class="code" href="class_p_r_g.html">PRG</a>(&amp;seed[i]);</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;                }</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;                io-&gt;<a class="code" href="class_i_o_channel.html#aa028f3ebb09c2cfa9c58be21ef81c271">recv_eb</a>((eb_t*)g, 2*EB_TABLE_MAX);</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;                io-&gt;<a class="code" href="class_i_o_channel.html#aa028f3ebb09c2cfa9c58be21ef81c271">recv_eb</a>((eb_t*)h, 2*EB_TABLE_MAX);</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;            } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;                eb_t tmp[2];</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; 2; ++i) {</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;                    prg.<a class="code" href="class_p_r_g.html#a0413492d30592c36c835091915bc9104">random_eb</a>(tmp, 2);</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;                    eb_mul_pre(g[i], tmp[0]);</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                    eb_mul_pre(h[i], tmp[1]);</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                }</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                io-&gt;<a class="code" href="class_i_o_channel.html#aad8d725dd71ade3a6e846349beb16d43">send_eb</a>((eb_t*)g, 2*EB_TABLE_MAX);</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                io-&gt;<a class="code" href="class_i_o_channel.html#aad8d725dd71ade3a6e846349beb16d43">send_eb</a>((eb_t*)h, 2*EB_TABLE_MAX);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                r = <span class="keyword">new</span> bn_t[<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>];</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                prg.<a class="code" href="class_p_r_g.html#ab8560a2768e2ed1d9ce3cdc26a3b793d">random_bn</a>(r, length);</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;            }</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        }</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a08bfbb15606bc57e36aa3a594a5e40a6">   42</a></span>&#160;    <a class="code" href="class_hc_o_t.html#a08bfbb15606bc57e36aa3a594a5e40a6">~HcOT</a>() {</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        <span class="keywordflow">if</span>(prgs!=<span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>; ++i)</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                <span class="keyword">delete</span> prgs[i];</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;            <span class="keyword">delete</span>[] <a class="code" href="class_hc_o_t.html#aa102417d8e202cfaaba27b0171f3ae45">prgs</a>;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        }</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        <span class="keywordflow">if</span>(r!=<span class="keyword">nullptr</span>) <span class="keyword">delete</span>[] <a class="code" href="class_hc_o_t.html#a4505d955cd652294a12f69ebac2ea517">r</a>;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <span class="keywordflow">if</span>(Y!=<span class="keyword">nullptr</span>) <span class="keyword">delete</span>[] <a class="code" href="class_hc_o_t.html#acb6acd06a2c710dc7dbd74d2a14aa100">Y</a>;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    }</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a0d57690c06c334e1dda74cfc47beba9b">   52</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_hc_o_t.html#a0d57690c06c334e1dda74cfc47beba9b">send</a>(<a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a> *L ) {</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        <a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a> *X = <span class="keyword">new</span> <a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a>[K*<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>];</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        <a class="code" href="utils__ec_8h.html#a09cbcd1b9548176fce4883fa31bbd17f">bn_tpl</a> *r = <span class="keyword">new</span> <a class="code" href="utils__ec_8h.html#a09cbcd1b9548176fce4883fa31bbd17f">bn_tpl</a>[K*<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>];</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        <a class="code" href="utils__ec_8h.html#a09cbcd1b9548176fce4883fa31bbd17f">bn_tpl</a> *s = <span class="keyword">new</span> <a class="code" href="utils__ec_8h.html#a09cbcd1b9548176fce4883fa31bbd17f">bn_tpl</a>[K*<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>];</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        eb_t (*glT)[EB_TABLE_MAX] = <span class="keyword">new</span> eb_t[<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>][EB_TABLE_MAX];</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;        eb_t (*hlT)[EB_TABLE_MAX] = <span class="keyword">new</span> eb_t[<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>][EB_TABLE_MAX];</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                eb_t tmp, tmp2;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>; ++i) {</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;            io-&gt;<a class="code" href="class_i_o_channel.html#aa028f3ebb09c2cfa9c58be21ef81c271">recv_eb</a>(&amp;tmp, 1);</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            eb_mul_pre(glT[i], tmp);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            io-&gt;<a class="code" href="class_i_o_channel.html#aa028f3ebb09c2cfa9c58be21ef81c271">recv_eb</a>(&amp;tmp, 1);</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            eb_mul_pre(hlT[i], tmp);</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        }</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>; ++i) {</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>; ++j) {</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;                prgs[j]-&gt;<a class="code" href="class_p_r_g.html#ab8560a2768e2ed1d9ce3cdc26a3b793d">random_bn</a>(r[i*K+j], 2);</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;                prgs[j]-&gt;<a class="code" href="class_p_r_g.html#ab8560a2768e2ed1d9ce3cdc26a3b793d">random_bn</a>(s[i*K+j], 2);</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">int</span> ind = 0; ind &lt; 2; ++ind){</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;                    eb_mul_fix_norm(X[i*K+j][ind], g[ind], r[i*K+j][ind]);</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;                    eb_mul_fix_norm(tmp, h[ind], s[i*K+j][ind]);</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;                    eb_add_norm(X[i*K+j][ind], X[i*K+j][ind], tmp);</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;                }</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;                io-&gt;<a class="code" href="class_i_o_channel.html#aad8d725dd71ade3a6e846349beb16d43">send_eb</a>(X[i*K+j], 2);</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;            }</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        }</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>; ++i) {</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>; ++j) {</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;                <span class="keywordflow">for</span>(<span class="keywordtype">int</span> ind = 0; ind &lt; 2; ++ind) {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                    eb_mul_fix_norm(tmp, glT[i], r[i*K+j][ind]);</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                    eb_mul_fix_norm(tmp2, hlT[i], s[i*K+j][ind]);</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                    eb_add_norm(tmp, tmp2, tmp);</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                    eb_add_norm(tmp, tmp, L[i*K+j][ind]);</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;                    io-&gt;<a class="code" href="class_i_o_channel.html#aad8d725dd71ade3a6e846349beb16d43">send_eb</a>(&amp;tmp, 1);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                }</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;            }</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        }</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keyword">delete</span>[] X;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        <span class="keyword">delete</span>[] <a class="code" href="class_hc_o_t.html#a4505d955cd652294a12f69ebac2ea517">r</a>;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        <span class="keyword">delete</span>[] s;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        <span class="keyword">delete</span> glT;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        <span class="keyword">delete</span> hlT;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    }</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a24078c65e7a0e1360e0eb3295cd2cad0">   98</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_hc_o_t.html#a24078c65e7a0e1360e0eb3295cd2cad0">recv</a>(eb_t * L, <span class="keywordtype">bool</span> * b) {</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        eb_t g_loc, h_loc;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        Y = <span class="keyword">new</span> <a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a>[K*<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>];</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>; ++i) {</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;            <span class="keywordtype">int</span> ind = b[i] ? 1: 0;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;            eb_mul_fix_norm(g_loc, g[ind], r[i]);</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;            io-&gt;<a class="code" href="class_i_o_channel.html#aad8d725dd71ade3a6e846349beb16d43">send_eb</a>(&amp;g_loc, 1);</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;            eb_mul_fix_norm(h_loc, h[ind], r[i]);</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            io-&gt;<a class="code" href="class_i_o_channel.html#aad8d725dd71ade3a6e846349beb16d43">send_eb</a>(&amp;h_loc, 1);</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;        }</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        <a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a> *X = <span class="keyword">new</span> <a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a>[K*<a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>];</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>; ++i) {</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>; ++j) {</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                io-&gt;<a class="code" href="class_i_o_channel.html#aa028f3ebb09c2cfa9c58be21ef81c271">recv_eb</a>(X[i*K+j], 2);</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;                <span class="keywordtype">int</span> ind = b[i] ? 1: 0;</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                eb_mul_norm(X[i*K+j][ind], X[i*K+j][ind], r[i]);</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;            }</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        }</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>; ++i) {</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">K</a>; ++j) {</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;                io-&gt;<a class="code" href="class_i_o_channel.html#aa028f3ebb09c2cfa9c58be21ef81c271">recv_eb</a>(Y[i*K+j], 2);</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;                <span class="keywordtype">int</span> ind = b[i] ? 1: 0;</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;                eb_sub_norm(L[i*K+j], Y[i*K+j][ind], X[i*K+j][ind]);</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;            }</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        }</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        <span class="keyword">delete</span>[] X;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    }</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div><div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="class_hc_o_t.html#a058d3b83ffa6976329cc66c92d2e5ce7">  128</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_hc_o_t.html#a058d3b83ffa6976329cc66c92d2e5ce7">open</a>(<a class="code" href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a>* Xs, <span class="keyword">const</span> eb_t* old_X, <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> seed, <span class="keywordtype">bool</span> *b, <span class="keywordtype">int</span> index) {</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <a class="code" href="class_p_r_g.html">PRG</a> seed_prg(&amp;seed);</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        <a class="code" href="utils__ec_8h.html#a09cbcd1b9548176fce4883fa31bbd17f">bn_tpl</a> s, t;</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">length</a>; ++i) {</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;            seed_prg.<a class="code" href="class_p_r_g.html#ab8560a2768e2ed1d9ce3cdc26a3b793d">random_bn</a>(s, 2);</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;            seed_prg.<a class="code" href="class_p_r_g.html#ab8560a2768e2ed1d9ce3cdc26a3b793d">random_bn</a>(t, 2);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;            <span class="keywordtype">int</span> ind = b[i] ? 1 : 0;</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;            eb_copy(Xs[i*K+index][ind], old_X[i*K+index]);</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;            eb_t tmp;</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            bn_mul_mod(s[1-ind], s[1-ind], r[i], q);</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;            eb_mul_fix_norm(tmp, g[ind], s[1-ind]);</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;            bn_mul_mod(t[1-ind], t[1-ind], r[i], q);</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            eb_mul_fix_norm(Xs[i*K+index][1-ind], h[ind], t[1-ind]);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;            eb_add_norm(Xs[i*K+index][1-ind], Xs[i*K+index][1-ind], tmp);</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;            eb_sub_norm(Xs[i*K+index][1-ind], Y[i*K+index][1-ind], Xs[i*K+index][1-ind]);</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        }</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    }</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;};</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="class_hc_o_t_html_aa0b6c6d33ee80418cb46846ee8708863"><div class="ttname"><a href="class_hc_o_t.html#aa0b6c6d33ee80418cb46846ee8708863">HcOT::K</a></div><div class="ttdeci">int K</div><div class="ttdef"><b>Definition:</b> hcot.h:14</div></div>
<div class="ttc" id="class_hc_o_t_html_a118fd98fa5e2adedf184b452be80ad7e"><div class="ttname"><a href="class_hc_o_t.html#a118fd98fa5e2adedf184b452be80ad7e">HcOT::g</a></div><div class="ttdeci">eb_t g[2][EB_TABLE_MAX]</div><div class="ttdef"><b>Definition:</b> hcot.h:7</div></div>
<div class="ttc" id="class_hc_o_t_html_a13183fe53e5debba15458246c652acf9"><div class="ttname"><a href="class_hc_o_t.html#a13183fe53e5debba15458246c652acf9">HcOT::prg</a></div><div class="ttdeci">PRG prg</div><div class="ttdef"><b>Definition:</b> hcot.h:12</div></div>
<div class="ttc" id="class_hc_o_t_html_ae252ee4c1b755a0026a427722ad2d64a"><div class="ttname"><a href="class_hc_o_t.html#ae252ee4c1b755a0026a427722ad2d64a">HcOT::io</a></div><div class="ttdeci">NetIO * io</div><div class="ttdef"><b>Definition:</b> hcot.h:10</div></div>
<div class="ttc" id="garble_2block_8h_html_a65abbf31b0a30290189cdb5059b5f785"><div class="ttname"><a href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a></div><div class="ttdeci">__m128i block</div><div class="ttdef"><b>Definition:</b> block.h:8</div></div>
<div class="ttc" id="class_hc_o_t_html_aa462e01ea0fe150c59534fabae45e693"><div class="ttname"><a href="class_hc_o_t.html#aa462e01ea0fe150c59534fabae45e693">HcOT::alpha1</a></div><div class="ttdeci">bn_t alpha1</div><div class="ttdef"><b>Definition:</b> hcot.h:6</div></div>
<div class="ttc" id="class_hc_o_t_html_ab7937e38f9710074431105c401c19228"><div class="ttname"><a href="class_hc_o_t.html#ab7937e38f9710074431105c401c19228">HcOT::HcOT</a></div><div class="ttdeci">HcOT(bool is_sender, NetIO *_io, int _k, int l, block *seed=nullptr)</div><div class="ttdef"><b>Definition:</b> hcot.h:18</div></div>
<div class="ttc" id="class_hc_o_t_html"><div class="ttname"><a href="class_hc_o_t.html">HcOT</a></div><div class="ttdef"><b>Definition:</b> hcot.h:5</div></div>
<div class="ttc" id="class_hc_o_t_html_a08bfbb15606bc57e36aa3a594a5e40a6"><div class="ttname"><a href="class_hc_o_t.html#a08bfbb15606bc57e36aa3a594a5e40a6">HcOT::~HcOT</a></div><div class="ttdeci">~HcOT()</div><div class="ttdef"><b>Definition:</b> hcot.h:42</div></div>
<div class="ttc" id="class_hc_o_t_html_a4505d955cd652294a12f69ebac2ea517"><div class="ttname"><a href="class_hc_o_t.html#a4505d955cd652294a12f69ebac2ea517">HcOT::r</a></div><div class="ttdeci">bn_t * r</div><div class="ttdef"><b>Definition:</b> hcot.h:9</div></div>
<div class="ttc" id="class_hc_o_t_html_acb6acd06a2c710dc7dbd74d2a14aa100"><div class="ttname"><a href="class_hc_o_t.html#acb6acd06a2c710dc7dbd74d2a14aa100">HcOT::Y</a></div><div class="ttdeci">eb_tpl * Y</div><div class="ttdef"><b>Definition:</b> hcot.h:17</div></div>
<div class="ttc" id="class_net_i_o_html"><div class="ttname"><a href="class_net_i_o.html">NetIO</a></div><div class="ttdef"><b>Definition:</b> net_io_channel.h:22</div></div>
<div class="ttc" id="class_hc_o_t_html_a0d57690c06c334e1dda74cfc47beba9b"><div class="ttname"><a href="class_hc_o_t.html#a0d57690c06c334e1dda74cfc47beba9b">HcOT::send</a></div><div class="ttdeci">void send(eb_tpl *L)</div><div class="ttdef"><b>Definition:</b> hcot.h:52</div></div>
<div class="ttc" id="class_hc_o_t_html_a485f9f51f0cacdd55027024268516829"><div class="ttname"><a href="class_hc_o_t.html#a485f9f51f0cacdd55027024268516829">HcOT::q</a></div><div class="ttdeci">bn_t q</div><div class="ttdef"><b>Definition:</b> hcot.h:13</div></div>
<div class="ttc" id="class_hc_o_t_html_adac7263c903c7a8449ad7f46f496b56b"><div class="ttname"><a href="class_hc_o_t.html#adac7263c903c7a8449ad7f46f496b56b">HcOT::y</a></div><div class="ttdeci">bn_t y</div><div class="ttdef"><b>Definition:</b> hcot.h:6</div></div>
<div class="ttc" id="class_i_o_channel_html_aa028f3ebb09c2cfa9c58be21ef81c271"><div class="ttname"><a href="class_i_o_channel.html#aa028f3ebb09c2cfa9c58be21ef81c271">IOChannel::recv_eb</a></div><div class="ttdeci">void recv_eb(eb_t *eb, size_t num)</div><div class="ttdef"><b>Definition:</b> io_channel.h:150</div></div>
<div class="ttc" id="utils__ec_8h_html_afcde481e82d4efeed62b66b9f12ccbd9"><div class="ttname"><a href="utils__ec_8h.html#afcde481e82d4efeed62b66b9f12ccbd9">eb_tpl</a></div><div class="ttdeci">eb_t eb_tpl[2]</div><div class="ttdef"><b>Definition:</b> utils_ec.h:14</div></div>
<div class="ttc" id="class_i_o_channel_html_aad8d725dd71ade3a6e846349beb16d43"><div class="ttname"><a href="class_i_o_channel.html#aad8d725dd71ade3a6e846349beb16d43">IOChannel::send_eb</a></div><div class="ttdeci">void send_eb(const eb_t *eb, size_t num)</div><div class="ttdef"><b>Definition:</b> io_channel.h:140</div></div>
<div class="ttc" id="utils__ec_8h_html_a09cbcd1b9548176fce4883fa31bbd17f"><div class="ttname"><a href="utils__ec_8h.html#a09cbcd1b9548176fce4883fa31bbd17f">bn_tpl</a></div><div class="ttdeci">bn_t bn_tpl[2]</div><div class="ttdef"><b>Definition:</b> utils_ec.h:15</div></div>
<div class="ttc" id="class_hc_o_t_html_a8f46c6db54fc3de20c01fd3cfd5e3e4a"><div class="ttname"><a href="class_hc_o_t.html#a8f46c6db54fc3de20c01fd3cfd5e3e4a">HcOT::length</a></div><div class="ttdeci">int length</div><div class="ttdef"><b>Definition:</b> hcot.h:16</div></div>
<div class="ttc" id="class_hc_o_t_html_a7a36395c32e14e20cf400fdbe9c7ba1e"><div class="ttname"><a href="class_hc_o_t.html#a7a36395c32e14e20cf400fdbe9c7ba1e">HcOT::alpha0</a></div><div class="ttdeci">bn_t alpha0</div><div class="ttdef"><b>Definition:</b> hcot.h:6</div></div>
<div class="ttc" id="class_hc_o_t_html_a058d3b83ffa6976329cc66c92d2e5ce7"><div class="ttname"><a href="class_hc_o_t.html#a058d3b83ffa6976329cc66c92d2e5ce7">HcOT::open</a></div><div class="ttdeci">void open(eb_tpl *Xs, const eb_t *old_X, block seed, bool *b, int index)</div><div class="ttdef"><b>Definition:</b> hcot.h:128</div></div>
<div class="ttc" id="class_hc_o_t_html_aa102417d8e202cfaaba27b0171f3ae45"><div class="ttname"><a href="class_hc_o_t.html#aa102417d8e202cfaaba27b0171f3ae45">HcOT::prgs</a></div><div class="ttdeci">PRG ** prgs</div><div class="ttdef"><b>Definition:</b> hcot.h:15</div></div>
<div class="ttc" id="utils__ec_8h_html_a782fdb3f06e7f49116d014d4a583b19f"><div class="ttname"><a href="utils__ec_8h.html#a782fdb3f06e7f49116d014d4a583b19f">initialize_relic</a></div><div class="ttdeci">void initialize_relic()</div><div class="ttdef"><b>Definition:</b> utils_ec.hpp:8</div></div>
<div class="ttc" id="class_p_r_g_html"><div class="ttname"><a href="class_p_r_g.html">PRG</a></div><div class="ttdef"><b>Definition:</b> prg.h:16</div></div>
<div class="ttc" id="class_p_r_g_html_ab8560a2768e2ed1d9ce3cdc26a3b793d"><div class="ttname"><a href="class_p_r_g.html#ab8560a2768e2ed1d9ce3cdc26a3b793d">PRG::random_bn</a></div><div class="ttdeci">void random_bn(T t, L... l)</div><div class="ttdef"><b>Definition:</b> prg.h:87</div></div>
<div class="ttc" id="class_p_r_g_html_a0413492d30592c36c835091915bc9104"><div class="ttname"><a href="class_p_r_g.html#a0413492d30592c36c835091915bc9104">PRG::random_eb</a></div><div class="ttdeci">void random_eb(T t, L... l)</div><div class="ttdef"><b>Definition:</b> prg.h:113</div></div>
<div class="ttc" id="class_hc_o_t_html_a70e477bac83ec6896655403775e12cf0"><div class="ttname"><a href="class_hc_o_t.html#a70e477bac83ec6896655403775e12cf0">HcOT::h</a></div><div class="ttdeci">eb_t h[2][EB_TABLE_MAX]</div><div class="ttdef"><b>Definition:</b> hcot.h:8</div></div>
<div class="ttc" id="class_hc_o_t_html_a24078c65e7a0e1360e0eb3295cd2cad0"><div class="ttname"><a href="class_hc_o_t.html#a24078c65e7a0e1360e0eb3295cd2cad0">HcOT::recv</a></div><div class="ttdeci">void recv(eb_t *L, bool *b)</div><div class="ttdef"><b>Definition:</b> hcot.h:98</div></div>
<div class="ttc" id="class_hc_o_t_html_ab4886a4c3628dd0e53bae56cfab49c66"><div class="ttname"><a href="class_hc_o_t.html#ab4886a4c3628dd0e53bae56cfab49c66">HcOT::sender</a></div><div class="ttdeci">bool sender</div><div class="ttdef"><b>Definition:</b> hcot.h:11</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_a27d30adcb009e917fb5e1bf5d93fdaa.html">emp-input-validity</a></li><li class="navelem"><a class="el" href="dir_bc3e805260d4f4a48e3ca8a737c0cdb5.html">input-validity</a></li><li class="navelem"><a class="el" href="hcot_8h.html">hcot.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
